Change sprintf() to babl_strcat() in model create_name()
authorDanny Robson <danny@blubinc.net>
Sun, 19 Jul 2009 11:35:40 +0000 (21:35 +1000)
committerMartin Nordholts <martinn@src.gnome.org>
Sun, 19 Jul 2009 13:30:45 +0000 (15:30 +0200)
commit79a4a198fe1a201be8d84186717964c26763e1ac
tree54ea3b9a024b163edf0a4a26a4dac124e4826029
parent13541095db663c954cc068872eb97edfc5fbdb32
Change sprintf() to babl_strcat() in model create_name()

babl/babl-model.c create_name uses an unsafe incantation of sprintf
to build names from concatenated components which should ideally use a
"%s" format specifier preceding the instance name.

Instead of fixing this, we replace it with a babl_strcat() based
alternative which allows us to remove the thread-unsafe static character
buffer at the cost of a few mallocs and a free.

Also do some cleanups, mainly to avoid two exit points from the
function, that increases readability and warns if a model with the
same name is registered twice.

This is bug #589021.
babl/babl-model.c